/**
 * Created by heshufen on 20/6/29.
 */

import {Platform,Dimensions} from 'react-native'

let screenW = Dimensions.get('window').width;
let screenH = Dimensions.get('window').height;
// iPhoneX
const X_WIDTH = 375
const X_HEIGHT = 812

const X_BOTTOM_HEIGHT = 34

export function isIphoneX() {

    if(Platform.OS === 'ios' && screenH === 896) {
        return true
    }

    return (
        Platform.OS === 'ios' &&
        ((screenH === X_HEIGHT && screenW === X_WIDTH) ||
            (screenH === X_WIDTH && screenW === X_HEIGHT))
    )
}

//iPhoneX 底部高度兼容处理
export function isIPhoneXFooter(number){
    number = isNaN(+number) ? 0 : +number;
    return number + (isIphoneX() ? X_BOTTOM_HEIGHT : 0)
}
